home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DOS.SWG / 0018_Batch Error Level.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  727b  |  46 lines

  1. {
  2. SEAN PALMER
  3.  
  4. > How would I use this Variable after I Exit the pascal Program??
  5.  
  6. You wouldn't. It won't work. What you COULD do though is to have it return an
  7. errorlevel to Dos if you cancel...
  8. }
  9.  
  10. Program ruSure;
  11. Uses
  12.   Crt;
  13.  
  14. Procedure yes;
  15. begin
  16.   TextAttr := 12;
  17.   Writeln('Okay.');  {no error here}
  18. end;
  19.  
  20. Procedure no;
  21. begin
  22.   TextAttr := 26;
  23.   Writeln('Aborted.');
  24.   halt(1);          {report an error to Dos}
  25. end;
  26.  
  27. begin
  28.   TextAttr := 13;
  29.   Write('Do you wish to continue? [Y/N]');
  30.   Case upcase(ReadKey) of
  31.     'Y' : yes;
  32.     'N' : no;
  33.   end;
  34. end.
  35. {
  36.  
  37.  Now the batch file :
  38.  
  39. rusure
  40. REM check For an error from the Program
  41. if errorlevel 1 Goto NOPE
  42. goto EXIT
  43. :NOPE
  44. cd ..
  45. etc.
  46.